import Vue from 'vue'
import VueRouter from 'vue-router'

// MainComponents
import Home from '@/views/Home/Home.vue'
import Orders from '@/views/Order/Order.vue'
import My from '@/views/My/My.vue'

// SubComponents

// Home
import Order from '@/views/Home/Order.vue'
import ResInfodt from '@/views/Home/ResInfodt.vue'

// commonComponents
import Rpshop from '@/views/Common/Rpshop.vue'
import Coupons from '@/views/Common/Coupons.vue'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/home' },
  { path: '/home', component: Home, meta: { title: '首页', showtab: true } },
  { path: '/order', component: Orders, meta: { title: '订单', showtab: true } },
  { path: '/my', component: My, meta: { title: '我的', showtab: true } },
  { path: '/takeout', component: Order, meta: { title: '外卖点餐', isback: true } },
  { path: '/forhere', component: Order, meta: { title: '堂食点餐', isback: true } },
  { path: '/resinfo', component: ResInfodt, meta: { title: '餐厅信息', isback: true } },
  { path: '/rpshop', component: Rpshop, meta: { title: '积分商城', isback: true } },
  { path: '/coupon', component: Coupons, meta: { title: '优惠券', isback: true } }
]

const router = new VueRouter({
  routes
})

router.beforeEach((to, from, next) => {
  next()
})

export default router